package android07.newtop.app;

import android.app.Application;

import com.jude.beam.Beam;
import com.jude.beam.bijection.ActivityLifeCycleDelegate;
import com.jude.beam.bijection.ActivityLifeCycleDelegateProvider;
import com.jude.beam.bijection.BeamAppCompatActivity;
import com.lidroid.xutils.DbUtils;


import java.io.File;

import android07.newtop.BuildConfig;
import android07.newtop.utils.JUtils;
import android07.newtop.utils.LogUtil;


/**

 */
public class APP extends Application {
    private static final String TAG = "APP";
    public static APP instance;
    public static int VERSION;
    public static String VERSION_NAME;

    public static APP getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        Beam.init(this);
        Beam.setActivityLifeCycleDelegateProvider(new ActivityLifeCycleDelegateProvider() {
            @Override
            public ActivityLifeCycleDelegate createActivityLifeCycleDelegate(BeamAppCompatActivity activity) {
                return new ActivityDelegate(activity);
            }


        });

        initDb();
        JUtils.initialize(this);
        JUtils.setDebug(false, "heheda");
    }

    private void initDb() {

        DbUtils.DaoConfig config = new DbUtils.DaoConfig(instance);
        config.setDbName("newstop"); //db名
        config.setDbVersion(1);  //db版本
        DbUtils db = DbUtils.create(config);//db还有其他的一些构造方法，比如含有更新表版本的监听器的

    }

}
